package io.renren.modules.report.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.report.entity.PackageUserEntity;
import io.renren.modules.report.service.PackageUserService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author august
 * @email 379249906@qq.com
 * @date 2020-07-09 16:05:50
 */
@RestController
@RequestMapping("report/packageuser")
public class PackageUserController {
    @Autowired
    private PackageUserService packageUserService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("report:packageuser:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = packageUserService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("report:packageuser:info")
    public R info(@PathVariable("id") Long id){
		PackageUserEntity packageUser = packageUserService.getById(id);

        return R.ok().put("packageUser", packageUser);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("report:packageuser:save")
    public R save(@RequestBody PackageUserEntity packageUser){
		packageUserService.save(packageUser);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("report:packageuser:update")
    public R update(@RequestBody PackageUserEntity packageUser){
		packageUserService.updateById(packageUser);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("report:packageuser:delete")
    public R delete(@RequestBody Long[] ids){
		packageUserService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
